import { createApp } from 'vue'
// 引入element-plus插件与样式

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
//@ts-expect-error
import App from '@/App.vue'
import '@/styles/index.scss'
// svg需要的配置代码
import 'virtual:svg-icons-register'
// import axios from 'axios'
// 配置中文
//@ts-expect-error忽略当前文件ts类型的检测否则有红色提示(打包会失败)
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'

//引入自定义插件对象:注册整个项目全局组件
import globalComponent from '@/components/index.ts'
//引入路由
import router from './router/index'
//引入pinia
import { createPinia } from 'pinia'
import './permission.ts'

const pinia = createPinia()

// 获取应用实例对象app
const app = createApp(App)

//引入自定义指令文件
import { isHasButton } from './directive/has.ts'
isHasButton(app)

// 安装element-plus 插件
app.use(ElementPlus, {
  locale: zhCn,
})
app.use(globalComponent)
//注册模板路由
app.use(router)
app.use(pinia)

//测试mock
/* axios({
  url: '/api/user/login',
  method: "post",
  data: {
    username: 'admin',
    password: '113111'
  }
}) */
// 将应用挂载到挂载点上
app.mount('#app')
